<template>
  <div class="card-container">
    <div class="card-title">
      <h3 @click="handleClick(content.title)">
        <i>{{ content.titleLabel + '-' }}</i>{{ content.title }}
      </h3>
      <img :src="image1" alt="" />
    </div>
    <div
      class="card-content"
      :class="`card-content-bg${content.index}`"
      @click="handleClick(content.title)"
    >
      {{ content.description }}
    </div>
  </div>
</template>

<script>
import { getOssUrl } from '@src/util/assets'
const image1 = getOssUrl('/managementReport3.png')
export default {
  props: {
    content: {
      type: Object,
      default: () => ({}),
    },
  },
  emits: ['menuToggle'],
  setup(_, { emit }) {
    const handleClick = title => {
      emit('menuToggle', title);
    };

    return { handleClick, image1 };
  },
};
</script>

<style lang="scss" scoped>
.card-container {
  width: 100%;
  display: flex;
  flex-direction: column;

  .card-title {
    width: 100%;
    position: relative;

    h3 {
      font-size: 20px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #ffffff;
      line-height: 28px;
      letter-spacing: 1px;
      position: absolute;
      left: 0;
      top: -20px;
      cursor: pointer;
      i {
        font-size: 22px;
        font-style: normal;
      }
    }

    img {
      width: 100%;
      height: auto;
    }
  }

  .card-content {
    width: 100%;
    height: 116px;
    border-radius: 8px;
    margin-top: 20px;
    padding: 0 5%;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #ffffff;
    line-height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .card-content-bg1 {
    background: rgba(78, 172, 151, 0.3);
    border: 1px solid #56c9a1;
  }

  .card-content-bg2 {
    background: rgba(180, 136, 49, 0.3);
    border: 1px solid #b48831;
  }

  .card-content-bg3 {
    background: rgba(38, 134, 145, 0.3);
    border: 1px solid #268691;
  }

  .card-content-bg4 {
    background: rgba(222, 102, 77, 0.3);
    border: 1px solid #de664d;
  }

  .card-content:hover {
    background: rgba(8, 25, 71, 0.3);
    cursor: pointer;
  }
}
</style>
